import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path : '*',
      name : 'Error',
      component:resolve => require(['@/pages/Error'],resolve),
      // 404页面的设置
    },
    {
      path: '/',
      name: 'index',
      component:resolve => require(['@/pages/index'],resolve),
      //resolve 懒加载 (通过懒加载就不会一次性把所有组件都加载进来，而是当你访问到那个组件的时候才会加载那一个。对于组件比较多的应用会提高首次加载速度。)
      //redirect 重定向 ( { path: '/', redirect: '/index'}, 这样进/ 就会跳转到/index)
      //alias 别名的使用 alias:'/'
      //编程式导航：this.$router.go(-1) 和 this.$router.go(1)
    },
    {
      path: '/credit',
      name: 'credit',
      component:resolve => require(['@/pages/credit'],resolve), 
    },
    {
      path: '/user',
      name: 'user',
      component:resolve => require(['@/pages/user'],resolve),
    },
    {
      path: '/index/Loan',
      name: 'Loan',
      component:resolve => require(['@/pages/Loan'],resolve),  
    },
    {
      path: '/credit/userinfo',
      name: 'userinfo',
      component:resolve => require(['@/pages/userinfo'],resolve),  
    },
    {
      path: '/user/borrowList',
      name: 'borrowList',
      component:resolve => require(['@/pages/borrowList'],resolve),  
    },
    {
      path: '/user/repayList',
      name: 'repayList',
      component:resolve => require(['@/pages/repayList'],resolve),  
    },
    {
      path: '/user/expired',
      name: 'expired',
      component:resolve => require(['@/pages/expired'],resolve),  
    }
  ]
});